<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('提现设置')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-capital-apply">
		<div class="form-group">
			<label class="col-sm-3 control-label ">申请提现金额：</label>
			<div class="col-sm-8">
				<input class="form-control" type="number" name="unuseAmount" id="unuseAmount" th:value="${useAmount}" />
			</div>
		</div>
	</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">

	$("#form-capital-apply").validate({
		rules:{
			unuseAmount:{
				required:true,
			},
		},
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			edit();
		}
	}

	function edit() {
		var capitalId = '[[${capitalId}]]'
		var useAmount = '[[${useAmount}]]'
		var unuseAmount = $("#unuseAmount").val();
		if(useAmount < unuseAmount){
			$.modal.alertError("可体现金额小于您所提交的金额,请重新操作!");
			return;
		}
		$.ajax({
			cache : true,
			type : "POST",
			url : ctx + "channel/businessCapital/apply",
			data : {
				"unuseAmount": unuseAmount,
				"capitalId": capitalId,
				"status": "1"
			},
			async : false,
			error : function(request) {
				$.modal.alertError("系统错误");
			},
			success : function(data) {
				$.operate.successCallback(data);
			}
		});
	}
</script>
</body>
</html>
